<template>
  <div id="app">
    <el-row style="text-align: left">
      <el-col :span="24">
        <el-button size="medium" @click="myJobs()"
                   type="success">企业工作
        </el-button>
      </el-col>
    </el-row>
    <div style="margin-top: 20px; width: 400px">
      <el-form ref="form" :model="result" label-width="80px" v-loading="listLoading" disabled class="el-form-css">
        <el-form-item label="企业名称:">
          <el-input v-model="result.companyName"></el-input>
        </el-form-item>
        <el-form-item label="企业规模:">
          <el-input v-model="result.companySize"></el-input>
        </el-form-item>
        <el-form-item label="行业:">
          <el-input v-model="result.profession"></el-input>
        </el-form-item>
        <el-form-item label="创建时间:">
          <el-input v-model="result.createdTime"></el-input>
        </el-form-item>
        <el-form-item label="介绍:">
          <el-input type="textarea" maxlength="250" show-word-limit :autosize="{ minRows: 3}"
                    v-model="result.introduce"
                    style="width: 300px"></el-input>
        </el-form-item>
        <el-form-item label="地址:">
          <el-input type="textarea" maxlength="250" show-word-limit :autosize="{ minRows: 3}"
                    v-model="result.address"
                    style="width: 300px"></el-input>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import {getCompanyDetail} from "@/api";
import jwtUtil from "jwt-decode";

export default {
  name: "readCompany"
  , data() {
    return {
      listLoading: false,
      result: {}
    }
  },
  methods: {
    //组件方法
    headClass() {
      return "text-align:center"
    },
    rowClass() {
      return "text-align:center"
    },
    //方法
    myJobs() {
      if (this.user.userType === 1) {
        this.$router.push({
          path: '/seeker/readCompanyJobs',
          query: {id: this.result.id, companyName: this.result.companyName}
        })
      } else if (this.user.userType === 2) {
        this.$router.push({
          path: '/company/readCompanyJobs',
          query: {id: this.result.id, companyName: this.result.companyName}
        })
      }
    }

  },
  created() {
    this.listLoading = true
    this.user = jwtUtil(window.localStorage.getItem('Token'))
    getCompanyDetail(this.$route.query.id).then(res => {
      this.result = res.data
      this.listLoading = false
    })
  },
  mounted() {
  }
}
</script>

<style scoped>
.el-form-css .el-input, .el-select {
  width: 300px;
}

</style>